export class GameState {
    public static soundOn:boolean = false;
    public static gameMode:number = 0; // 0 Gaming 1 Editor
    public static editMode:number = 1; // 1 添加方块模式 2 删除方块模式 3 添加网点模式 4 删除网点模式
    public static curLevel:number = 1;

    public static reviveTimes: number = 0;
    public static randomTimes: number = 0;
    public static redoTimes: number = 0;
    public static removeTimes: number = 0;

    public static resetTimes () {
        this.reviveTimes = 1;
        this.randomTimes = 1;
        this.redoTimes = 1;
        this.removeTimes = 1;
    }

    public static levelData = [
        {"lv": 1, "types": 3, list: [{"x":-155,"y":190},{"x":-155,"y":150},{"x":153,"y":190},{"x":153,"y":150},{"x":-1,"y":190},{"x":-1,"y":150},{"x":-155,"y":-10},{"x":-155,"y":-50},{"x":-1,"y":-10},{"x":-1,"y":-50},{"x":153,"y":-10},{"x":153,"y":-50}]},
        {"lv": 2, "types": 16, list: [{"x":-39.5,"y":230},{"x":-1,"y":230},{"x":37.5,"y":230},{"x":76,"y":230},{"x":114.5,"y":230},{"x":153,"y":230},{"x":-116.5,"y":230},{"x":-116.5,"y":230},{"x":-78,"y":230},{"x":-39.5,"y":230},{"x":-1,"y":230},{"x":37.5,"y":230},{"x":76,"y":230},{"x":114.5,"y":230},{"x":153,"y":230},{"x":-155,"y":190},{"x":-116.5,"y":190},{"x":-78,"y":190},{"x":-39.5,"y":190},{"x":-1,"y":190},{"x":37.5,"y":190},{"x":76,"y":190},{"x":114.5,"y":190},{"x":191.5,"y":190},{"x":153,"y":190},{"x":-193.5,"y":150},{"x":-193.5,"y":150},{"x":-155,"y":150},{"x":-116.5,"y":150},{"x":-78,"y":150},{"x":-39.5,"y":150},{"x":-1,"y":150},{"x":37.5,"y":150},{"x":76,"y":150},{"x":114.5,"y":150},{"x":153,"y":150},{"x":191.5,"y":150},{"x":230,"y":150},{"x":230,"y":110},{"x":230,"y":-10},{"x":230,"y":-50},{"x":230,"y":-10},{"x":230,"y":30},{"x":230,"y":70},{"x":-193.5,"y":110},{"x":-193.5,"y":110},{"x":-193.5,"y":70},{"x":-193.5,"y":30},{"x":-193.5,"y":-10},{"x":-193.5,"y":-50},{"x":-155,"y":-50},{"x":-116.5,"y":-50},{"x":-78,"y":-50},{"x":-39.5,"y":-50},{"x":-1,"y":-50},{"x":37.5,"y":-50},{"x":114.5,"y":-50},{"x":114.5,"y":-50},{"x":153,"y":-50},{"x":-39.5,"y":190},{"x":-1,"y":190},{"x":37.5,"y":190},{"x":-39.5,"y":190},{"x":-155,"y":110},{"x":-155,"y":110},{"x":-116.5,"y":110},{"x":37.5,"y":110},{"x":76,"y":110},{"x":114.5,"y":110},{"x":153,"y":110},{"x":191.5,"y":110},{"x":153,"y":110},{"x":114.5,"y":110},{"x":76,"y":110},{"x":37.5,"y":110},{"x":-1,"y":110},{"x":-39.5,"y":110},{"x":-78,"y":110},{"x":-1,"y":30},{"x":-1,"y":30},{"x":-1,"y":70},{"x":-1,"y":30},{"x":-1,"y":-10},{"x":-1,"y":30},{"x":-39.5,"y":30},{"x":-78,"y":30},{"x":-116.5,"y":30},{"x":-155,"y":30},{"x":-116.5,"y":30},{"x":-78,"y":30},{"x":-39.5,"y":30},{"x":-1,"y":30},{"x":37.5,"y":30},{"x":76,"y":30},{"x":114.5,"y":30},{"x":153,"y":30},{"x":-1,"y":110},{"x":76,"y":110},{"x":-116.5,"y":30},{"x":-39.5,"y":30},{"x":37.5,"y":30},{"x":114.5,"y":30},{"x":114.5,"y":-50},{"x":37.5,"y":-50},{"x":-39.5,"y":-50},{"x":-116.5,"y":-50},{"x":-155,"y":-90},{"x":-155,"y":-90},{"x":-116.5,"y":-90},{"x":114.5,"y":-90},{"x":153,"y":-90},{"x":191.5,"y":-90},{"x":230,"y":-90},{"x":-193.5,"y":-170},{"x":-1,"y":-170},{"x":-78,"y":-170},{"x":-39.5,"y":-170},{"x":-116.5,"y":-170},{"x":-78,"y":-170},{"x":-39.5,"y":-170},{"x":153,"y":-170},{"x":191.5,"y":-170},{"x":114.5,"y":-170},{"x":76,"y":-170},{"x":37.5,"y":-170},{"x":-1,"y":-130},{"x":37.5,"y":-130},{"x":-1,"y":-130},{"x":-39.5,"y":-130},{"x":-78,"y":-130},{"x":191.5,"y":-130},{"x":153,"y":-250},{"x":37.5,"y":-210},{"x":-1,"y":-210},{"x":-39.5,"y":-210},{"x":-78,"y":-210},{"x":-155,"y":-250},{"x":-116.5,"y":-250},{"x":76,"y":-210},{"x":114.5,"y":-250},{"x":153,"y":-250},{"x":-1,"y":-130},{"x":76,"y":-130},{"x":37.5,"y":-290},{"x":37.5,"y":-290},{"x":-39.5,"y":-290},{"x":-39.5,"y":-290},{"x":-1,"y":-210},{"x":-1,"y":-210},{"x":-155,"y":-90}]},
    ]

    public static getLvData(lv: number) {
        const level = this.levelData.find(lvData => {
            return lvData.lv === lv
        })
        return level;
    }

    public static getMaxLevel() {
        let level:number = 1;
        this.levelData.map(lvData => {
            if(lvData.lv > level){
                level = lvData.lv
            }
        })
        return level;
    }
}


